<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('车辆主要信息列表')" />
</head>
<body class="gray-bg">

<input type="button" id="a" value="地图">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>vin码(主键)：</label>
                                <input type="text" name="vin"/>
                            </li>
                            <li>
                                <label>车辆状态(0:未销售;1:已销售;2:报废)：</label>
                                <select name="carStatus">
                                    <option value="0">未销售</option>
                                    <option value="1">已销售</option>
                                    <option value="2">报废</option>
                                </select>
                            </li>
                            <li>
                            <label>车牌号：</label>
                            <input type="text" name="carNum"/>
                        </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>

                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="carmain:carmain:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="carmain:carmain:edit">
                    <i class="fa fa-edit"></i> 修改
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="carmain:carmain:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="carmain:carmain:export">
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
     <div class="modal fade" id="add_one_record_modal" role="dialog" aria-describedby="add_one_record_modal">
         <div class="modal-dialog" role="document">
             <div class="modal-content">
                 <div class="modal-header">
                     <button class="close" type="button" data-dismiss="modal" aria-label="Close">&times;</button>
                     <h4 class="modal-title">车辆配置详情页面</h4>
                 </div>
                 <div class="modal-body">
                     <form id="add_one_record_form" action="/add_one" method="post" role="form" data-remote="true">
                         配置名称<input class="form-control" type="text" id="gender1" name="name">
                         车型型号名称<input class="form-control" type="text" id="gender2"  name="age">
                         车重  <input class="form-control" type="text" id="gender3"  name="gender">
                         车长 <input class="form-control" type="text" id="gender4"  name="gender">
                         车宽 <input class="form-control" type="text" id="gender5"  name="gender">
                         车高<input class="form-control" type="text" id="gender6"  name="gender">
                         载客数 <input class="form-control" type="text" id="gender7"  name="gender">
                         驱动方式<input class="form-control" type="text" id="gender8"  name="gender">
                         快充倍率<input class="form-control" type="text" id="gender9"  name="gender">
                         充电续航里程 <input class="form-control" type="text" id="gender10"  name="gender">
                         百公里加速<input class="form-control" type="text" id="gender11"  name="gender">
                         最高车速 <input class="form-control" type="text" id="gender12"  name="gender">
                         个档位转动比 <input class="form-control" type="text" id="gender13"  name="gender">
                         30分钟最高车速<input class="form-control" type="text" id="gender14"  name="gender">
                         节油率水平<input class="form-control" type="text" id="gender15"  name="gender">
                         百公里耗油量<input class="form-control" type="text" id="gender16"  name="gender">
                     </form>
                 </div>
             </div>
         </div>
     </div>

     <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('carmain:carmain:edit')}]];
        var removeFlag = [[${@permission.hasPermi('carmain:carmain:remove')}]];
        var prefix = ctx + "carmain/carmain";

        window.operateEvents={
            'click #xn':function (e,value,row,index) {
                alert(value)
                $.ajax({
                    url:"/car/config/getConfigById/"+value,
                    type:"get",
                    dataType:"json",
                    success:function (d) {
                        console.log(d)
                        $("#gender1").val(d.configName);
                        $("#gender2").val(d.carTypeId);
                        $("#gender3").val(d.carWeight);
                        $("#gender4").val(d.carWeight);
                        $("#gender5").val(d.carLong);
                        $("#gender6").val(d.carWide);
                        $("#gender7").val(d.carPassengers);
                        $("#gender8").val(d.driverMode);
                        $("#gender9").val(d.chargeRatio);
                        $("#gender10").val(d.pureBatteryRange);
                        $("#gender11").val(d.speedHundred);
                        $("#gender12").val(d.maxSpeed);
                        $("#gender13").val(d.ratioGear);
                        $("#gender14").val(d.maxSpeed30m);
                        $("#gender15").val(d.rateOilRate);
                        $("#gender16").val(d.powerHundred);
                    }
                })
            }
        }



        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "车辆主要信息",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'id',
                    title: 'null',
                    visible: false
                },
                {
                    field: 'vin',
                    title: 'vin码(主键)'
                },
                {
                    field: 'carTypeId',
                    title: '车型ID(外键)'
                },
                {
                    field: 'carKindId',
                    title: '车辆种类'
                },
                {
                    field: 'appoint',
                    title: '规约'
                },
                {
                    field: 'vendor',
                    title: '生产厂商'
                },
                {
                    field: 'vendorBatch',
                    title: '生产批次'
                },
                {
                    field: 'carStatus',
                    title: '车辆状态(0:未销售;1:已销售;2:报废)',
                    formatter: function(value, row, index) {
                            if(value==0){
                                return  '未销售'
                            }else if(value==1){
                                return '已销售';
                            }else {
                                return '报废';
                            }
                    }
                },
                {
                    field: 'configId',
                    title: '车辆预配置id',
                    events:'operateEvents',
                    formatter: function(value, row, index) {
                        return ' <a class="btn btn-primary" id="xn"  data-toggle="modal" data-target="#add_one_record_modal">'+value+'</a>';
                    }
                },
                    {
                        field: 'carQualifiedCode',
                        title: '合格证编号'
                    },
                    {
                        field: 'carQualityStatus',
                        title: '下线质检状态 0通过  1未通过'
                    },
                    {
                        field: 'carExpirationDate',
                        title: '整车保质期'
                    },
                    {
                        field: 'carCellId',
                        title: '电池包编号'
                    },
                    {
                        field: 'carMotorId',
                        title: '驱动机编号'
                    },
                    {
                        field: 'carTerminalId',
                        title: '终端编号'
                    },
                    {
                        field: 'internalNumber',
                        title: '内部编号'
                    },{
                        field: 'operatingUnit',
                        title: '运营单位'
                    },
                    {
                        field: 'responsibleName',
                        title: '车辆负责人'
                    },
                    {
                        field: 'responsibleTel',
                        title: '车辆负责人电话'
                    },
                    {
                        field: 'usage',
                        title: '车辆用途'
                    },
                    {
                        field: 'operatingDate',
                        title: '正式运营日期'
                    },
                    {
                        field: 'carTypeName',
                        title: '车型型号名称'
                    },
                    {
                        field: 'kindName',
                        title: '种类名称'
                    },
                    {
                        field: 'carNum',
                        title: '车牌号'
                    },
                    {
                        field: 'registrationArea',
                        title: '上牌区域'
                    },
                    {
                        field: 'carField',
                        title: '购车领域'
                    },
                    {
                        field: 'buyer',
                        title: '购买单位'
                    },
                    {
                        field: 'registrationTime',
                        title: '行驶证时间'
                    },
                    {
                        field: 'saleCarCode',
                        title: '车辆行驶证编号'
                    },
                    {
                        field: 'scrapDate',
                        title: '报废日期'
                    }, {
                        field: 'recycleCrditCode',
                        title: '回收统一信用代码'
                    },
                    {
                        field: 'simNumber',
                        title: 'sim卡号'
                    },
                    {
                        field: 'iccid',
                        title: 'ICCID'
                    },
                    {
                        field: 'motorModelName',
                        title: '电机型号名称'
                    },
                    {
                        field: 'terminalModelNameterminalModelName',
                        title: '终端型号名称'
                    },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });

        $("#a").onclick(function () {
            location.href="ditu.html"
        })
    </script>
</body>
</html>
